#ifndef HOST_LIST_H
#define HOST_LIST_H

#include "configuration.h"
#include "accesslist.h"
#include "rulelist.h"

typedef struct {
	const char *host_name;
	size_t host_name_length;
	const char *document_root;
	size_t document_root_length;
	const char *access_log;

	int fd;
	int own_access_log;

	int dirlisting;

	int have_authentication;
	accesslist_t accesslist;

	int log_requests;

	rulelist_t rulelist;
} host_t;

typedef struct {
	host_t *default_host;
	host_t *hosts;
	size_t size;
	size_t used;
} host_list_t;

void host_list_init (host_list_t *host_list);
void host_list_free (host_list_t *host_list);

int host_list_load (configuration_t *conf, host_list_t *host_list, int dirlisting, int have_authentication, int log_requests);

host_t *host_list_search_host (host_list_t *host_list, const char *host_name);

#endif /* HOST_LIST_H */
